<?php

namespace app\modules\controllers;

use yii\web\Controller;
use yii;
use app\models\Category;
/**
 * Default controller for the `admin` module
 */
class CategoryController extends Controller
{
	public $layout='layout1';
    /**
     * Renders the index view for the module
     * @return string
     */
    
    public function actionList()
    {
   
        return $this->render('Cates');
    }
    public function actionAdd()
    {

    	 
    	$model=new Category;
        
        $list=$model->getOptions();
         
        if(Yii::$app->request->isPost){
            $post=Yii::$app->request->post();
            if($model->add($post)){
          
                Yii::$app->session->setFlash('添加成功');
            }
        }
      
        return $this->render('Add',['model'=>$model,'list'=>$list]);
    }
	
	
	    public function actionDel()
    {

    	$model=new Category;

        return $this->render('del',['model'=>$model,'list'=>$list]);
    }
}
